/*
 * @Author       : NaN 353362604@qq.com
 * @Date         : 2023-05-09 10:05:16
 * @LastEditTime : 2023-06-15 16:25:30
 * @LastEditors  : NaN 353362604@qq.com
 * @FilePath     : \AdminStration\src\Pages\Front\Common\Template\QualityWarning.jsx
 * @Description  :
 */
import './Scss/QualityWarning.scss'

import { useEffect, useState } from 'react'
import { useRequest } from 'ahooks'
import { Http } from '../../../../Common/Api'

export const QualityWarning001 = ({ data }) => {
    const [Data, setData] = useState([])
    const { run: getGetQualityCount } = useRequest(Http, {
        manual: true,
        onSuccess: res => {
            const { list } = res
            const [fraction] = list
            setData(Object.keys(data).map(key => ({ uuid: key, title: data[key], value: fraction[key] || 0 })))
        },
    })
    useEffect(() => {
        getGetQualityCount({ url: `getGetQualityCount` })
    }, [getGetQualityCount])
    return (
        <div className="QualityWarning001">
            {Data.map(({ uuid, title, value }) => (
                <div key={uuid}>
                    <div>{title}</div>
                    <div>{value}</div>
                </div>
            ))}
        </div>
    )
}
